Helpful Information
 
 
Category: vBulletin 3.0
Ignore maxresults in "Search by username"

Hello everyone,

I've been lurking for the past several years and figured I should probably start sharing a few quick hacks to "give back". I did a quick search but couldn't find anything that did this.... ;)

What this does: Makes "Find all posts by (member name)" actually find ALL posts by that member and ignores the value you specify (via the AdminCP) for your maximum search results (maxresults). This maxresults limit is also ignored if someone specifies a username in your "advanced search" options.

It's good for boards that want to keep the maxresults limited for performance reasons, however still want to allow members to search for all their (or someone else's) past posts. :)

On to the hack: This one is real quick, only three lines are edited in one file.

In search.php:

1. Find:

if ($vboptions['maxresults'] > 0 AND $numitems > $vboptions['maxresults'])

Change to:

if ($vboptions['maxresults'] > 0 AND $numitems > $vboptions['maxresults'] AND !$search['searchuser'])

2. Find:

$threads = $DB_site->query("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS delthread ON(delthread.primaryid = thread.threadid AND delthread.type = 'thread')
WHERE forumid IN(" . implode(', ', $forumids) . ")
AND thread.lastpost >= $datecut
AND visible = 1
AND delthread.primaryid IS NULL
ORDER BY lastpost DESC
LIMIT $vboptions[maxresults]
");

Change to:

$threads = $DB_site->query("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS delthread ON(delthread.primaryid = thread.threadid AND delthread.type = 'thread')
WHERE forumid IN(" . implode(', ', $forumids) . ")
AND thread.lastpost >= $datecut
AND visible = 1
AND delthread.primaryid IS NULL
ORDER BY lastpost DESC
");

3. Remove:

LIMIT " . ($vboptions['maxresults'] * 2) . "

This has been tested on our medium-sized boards (350k posts, 3k users) running vB3 gold and everything seems to be in order.

Would be nice to search your own threads as well...

Hello again,

UPDATE: Added a quick bugfix and "feature enhancement" ;) that allows more than the maxresults limit for "New Posts" and "Today's Posts", as well.

And yes, it works for searching your own (or other people's) threads as well. :D

Is there an update for 3.5.4? I've had a go myself and I just can't get it working. :confused:

I want to return all the posts made in the last 24 hours without limit. Any help would be most appreciated. :)










privacy (GDPR)